<template>
	<view class="activityBox">
		<!-- 搜索 -->
		<view class="searchBox" @click="tiaosou">
			<view class="inputBox">
				<image src="/static/pages/index/searchImg.png" mode="" class="searchImg"></image>
				<input disabled="true" class="inpt" placeholder="请输入活动名称"
					placeholder-style="color:#9DA0A9;font-size:26rpx;" />
			</view>
			<view class="searchInput">
				搜索
			</view>
		</view>
		<!-- 内容 -->
		<view class="activityContent">
			<view class="activityList" v-for="(item,index) in contentList" @click="tiao_xq(item.id)">
				<view class="ctime">
					<text class="ctimew">活动时间:</text>
					<text style="margin-left: 20rpx;">{{item.starttime | formatDate}} - {{item.endtime | formatDate}}</text>
				</view>
				<view class="wire">
					
				</view>
				<view class="acName">
					{{item.name}}
				</view>
				<!-- <view class="fundsNum">
					<view class="fundsNum1">
						预算：
					</view>
					<view class="fundsNum2">
						{{item.money}}
					</view>
				</view> -->
				<view class="quota">
					<view class="quota1">
						剩余场次:
					</view>
					<view class="quota2">
						{{item.remaining}}
					</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	import {index} from '@/request/api.js'
	export default {
		data() {
			return {
				contentList: []
			};
		},
		onLoad() {
		},
		onShow(){
			this.OnList()
		},
		methods:{
			OnList(){
				index({
					cate_id:'',
					cate_id:0,
					page:1,
				}).then(res => {
					console.log(res);
					this.contentList = res.data.activity.data
					uni.showToast({
						title: res.msg,
						icon: "none"
					})
				})
			},
			tiao_xq:function(id){
				uni.navigateTo({
					url:'/pagesA/DLR/activityDetails?id=' + id
				})
				
			},
			
			tiaosou:function(){
				// uni.showToast({
				// 	title: "暂未开发",
				// 	icon: "none"
				// })
				uni.navigateTo({
					url:'../../../pagesA/DLR/search'
				})
			},
		},
		filters: {
			formatDate: function(value) {
				let date = new Date(value * 1000);
				//时间戳为10位需*1000，时间戳为13位的话不需乘1000
				let y = date.getFullYear();
				let MM = date.getMonth() + 1;
				MM = MM < 10 ? ('0' + MM) : MM; //月补0
				let d = date.getDate();
				d = d < 10 ? ('0' + d) : d; //天补0
				let h = date.getHours();
				h = h < 10 ? ('0' + h) : h; //小时补0
				let m = date.getMinutes();
				m = m < 10 ? ('0' + m) : m; //分钟补0
				let s = date.getSeconds();
				s = s < 10 ? ('0' + s) : s; //秒补0
				// console.log(y + '-' + MM + '-' + d);
				return y + '-' + MM + '-' + d; //年月日
		
			}
		},
		
		
	}
</script>

<style lang="scss">
	page {
		background-color: #FFFFFF;
	}

	.activityBox {
		width: 100%;
		box-sizing: border-box;
		padding-bottom: 40rpx;
		.searchBox {
			width: 100%;
			display: flex;
			justify-content: space-around;
			margin-top: 26rpx;

			.inputBox {
				width: 580rpx;
				height: 70rpx;
				background-color: #F0F1F5;
				border-radius: 60rpx;
				display: flex;

				.searchImg {
					width: 28rpx;
					height: 28rpx;
					margin: 21rpx 21rpx 0 24rpx;
				}

				.inpt {
					margin-top: 15rpx;
				}
			}

			.searchInput {
				font-size: 32rpx;
				font-family: PingFang SC;
				font-weight: 500;
				color: #2E2F33;
				margin-right: 40rpx;
				margin-top: 17rpx;
			}
		}
		.activityContent{
			width: 100%;
			// overflow: hidden;
			.activityList{
				width: 670rpx;
				// height: 330rpx;
				box-shadow: 0rpx 0rpx 14rpx 0rpx rgba(211, 213, 220, 0.4);
				border-radius: 24rpx;
				margin: 40rpx auto 0;
				overflow: hidden;
				.ctime{
					color: #979BA6;
					font-size: 26rpx;
					height: 70rpx;
					line-height: 70rpx;
					margin-left: 22rpx;
				}
				.wire{
					background-color: #ebecee;
					width: 100%;
					height: 4rpx;
					// margin-top: 23rpx;
					
				}
				.acName{
					font-size: 36rpx;
					color: #313233;
					line-height: 36rpx;
					// margin-top: 29rpx;
					// margin-left: 22rpx;
					margin: 30rpx 22rpx 50rpx;
				}
				.fundsNum{
					display: flex;
					// margin-top: 49rpx;
					margin-left: 22rpx;
					.fundsNum1{
						color: #313233;
						font-size: 36rpx;
					}
					.fundsNum2{
						color: #313233;
						font-size: 36rpx;
						margin-left: 123rpx;
					}
				}
				.quota{
					display: flex;
					// margin-top: 49rpx;
					// margin-left: 22rpx;
					margin: 50rpx 22rpx 30rpx;
					.quota1{
						color: #313233;
						font-size: 36rpx;
					}
					.quota2{
						color: #313233;
						font-size: 36rpx;
						margin-left: 145rpx;
					}
				}
			}
		}
	}
</style>
